#define  _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<string.h>
#include<assert.h>

void nizhi(char* left,char* right )
{
	assert(left && right);
	while (left < right)
	{
		char temp = *left;
		*left = *right;
		*right = temp;
		left++;
		right--;
	}
}

int main()
{
	char arr[100] = {0};
	gets(arr);
	int len = strlen(arr);
	nizhi(arr, arr + len - 1);
	char* count = arr;
	while (*count) {
		char* strat = count;
		while (*count != ' ' && *count != '\0') {
			count++;
		}
		nizhi(strat, count - 1);
		if (*count != '\0') {
			count++;
		}
	}
	printf("%s\n", arr);
	return 0;
}